﻿using Ledict.ConditionExtract.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Ledict.ConditionExtract.Frm.NodeTree
{
    public partial class ModuleSelect : BaseForm
    {
        public string Code { get; set; }
        public ModuleSelect(DataTable dt)
        {
            InitializeComponent();
            if (dt != null && dt.Rows.Count > 0)
            {
                cmbModule.DataSource = dt;
                cmbModule.DisplayMember = "EF_ModuleCode";
            }
        }

        /// <summary>
        /// 取消按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            this.Close();
        }

        /// <summary>
        /// 确认按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cmbModule.Text))
            {
                MessageBox.Show("请选择流程！");
                return;
            }
            else
            {
                Code = cmbModule.Text.ToString();
                DialogResult = DialogResult.Yes;
                this.Close();
            }
        }
    }
}
